<?php
/**
 * User: Hufeng
 * Date: 2017/12/04 17:51
 * Desc: 活动
 */
namespace App\Controller;
use App\Model\ActiveModel;

class Active extends Base {
    //活动首页
    public function index(){
        $awhere = ['status'=>1];
        $aModel = new ActiveModel();
        $aQuery = $aModel->queryData($awhere);
        $time = time();
        $ing = [];
        $past = [];
        foreach ($aQuery as $val){
            $arr = [];
            $arr['id'] = $val['id'];
            $arr['title'] = $val['title'];
            $arr['img'] = $val['active_img'];
            $arr['stime'] = $val['stime'];
            $arr['etime'] = $val['etime'];
            if(strtotime($val['etime'])<$time){
                $past[] = $arr;
            }else{
                $ing[] = $arr;
            }
        }
        $this->outData['data']['ing'] = $ing;
        $this->outData['data']['past'] = $past;
        return $this->fjson($this->outData);
    }

}
